<?php
namespace Home\Controller;
use Home\Model\Admin;
use Think\Controller;

/**
 *Admin后台，所有需要登录的控制器，都要继承自此类
 *@author Qiu Pengfei
 *@since 1.0
 */
class BaseController extends Controller
{
    public function __construct(){
        parent::__construct();
        if (!Admin::isLogin()) {
            //记住当前的url，写到 session中，登录成功后，跳去该url
            session('returnUrl', $_SERVER['REQUEST_URI']);
            $this->redirect('Default/login');
            exit;
        }
    }
}